prepare("select * from grain where productcode = $pcode" ) ; $getproduct->execute() ; while($row = $getproduct->fetch(pdo::FETCH_ASSOC) ) { if($row['measure'] == 'Carton') $percarton = $row['amount'] ; if($row['measure'] == 'Pieces') $perpiece = $row['amount'] ; // if($row['measure'] == 'Half Bag') $halfbagx = $row['amount'] ; //if($row['measure'] == 'Penta Bucket') $perpentax = $row['amount'] ; //if($row['measure'] == 'Half Penta') $halfpentax = $row['amount'] ; //if($row['measure'] == 'Litre') $perliterx = $row['amount'] ; } //get product name $getproductn = $DB_con->prepare("select * from products where product_code = $pcode" ) ; $getproductn->execute() ; $rown = $getproductn->fetch(pdo::FETCH_ASSOC) ; $product = $rown['product_name'] ; $price = $rown['price'] ; //get details of the admin $st = $_SESSION['st'] ; $ctry = $_SESSION['ctry'] ; $city = $_SESSION['city'] ; if(!$_SESSION['rs'] ) { $rs = 'nill' ; } else { $rs = $_SESSION['rs'] ; } if(isset($_POST['submit'])) { if($getproduct->rowcount() > 0) { $icode = $pcode ; $carton = $_POST['bag']; $pieces = $_POST['halfbag']; //$penta = $_POST['penta']; //$halfpenta = $_POST['halfpenta']; //$liter = $_POST['liter']; //$cup = $_POST['cup']; $mb = 'Carton' ; $mhb = 'Pieces' ; //$mp = 'Penta Bucket' ; //$mhp = 'Half Penta' ; //$mc = 'Cup' ; //$ml = 'Liter' ; $stmt = $DB_con->prepare("update grain set amount = :c where (productcode =:a and measure =:b)") ; $stmt->bindparam(":a", $icode) ; $stmt->bindparam(":b", $mb) ; $stmt->bindparam(":c", $carton) ; $stmt->execute() ; $stmt1 = $DB_con->prepare("update grain set amount = :c where (productcode =:a and measure =:b)") ; $stmt1->bindparam(":a", $icode) ; $stmt1->bindparam(":b", $mhb) ; $stmt1->bindparam(":c", $pieces) ; $stmt1->execute() ; header("location: home.php") ; } else { $icode = $pcode ; $carton = $_POST['bag']; $mc = 'Carton' ; $pieces = $_POST['halfbag']; $mp = "Pieces" ; $stmt = $DB_con->prepare("insert into grain (measure,productcode,amount) values(:a,:b,:c)" ) ; $stmt->bindparam(":a", $mc) ; $stmt->bindparam(":b", $icode) ; $stmt->bindparam(":c", $carton) ; $stmt->execute() ; $stmt2 = $DB_con->prepare("insert into grain (measure,productcode,amount) values(:a,:b,:c)" ) ; $stmt2->bindparam(":a", $mp) ; $stmt2->bindparam(":b", $icode) ; $stmt2->bindparam(":c", $pieces) ; $stmt2->execute() ; header("location: home.php") ; } } ?> Update

..Price Per Piece :